using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace WinCANTool
{
    public struct Message
    {
    /* This data structure is only used to store information from the parsed Symbol file */
        
        public string Name;
        public int Mask;
        public int IdentValue;
        public int Length;
        public int Direction;
        public int SendRate;

    }

    public class MessageData
    {
    /* This data structure may seem a bit redundent, but it is used to pass message
     * information from edit forms to the RxTx form. 
     * it does not contain timestamp, count or display information as the NewMessage
     * structure does    */

        public string Name;
        private int Identifier;
        public int DLC;
        public int SendRate;
        public int [] Data = new int[8];

        public void SetIdentifier(int var)
        {
            Identifier = var;
        }

        public int GetIdentifier()
        {
            return Identifier;
        }

        public void GetData(ref byte[] Destination)
        {
            for (int i = 0; i < 8; i++)
            {
                Destination[i] = (byte) Data[i];
            }
        }

    }

    
    public struct SubMessage
    {
        public string SubMessageName;
        public string MessageId;
        public int Mask;
        //public int SubValue;
    }

    public struct DataWord
    {
        public string Name;
        public string MessageId;
        public string LinkedData;
        public string WordType;
        public string EndianType;
        public int StartByte;
        public int SubIndexStartByte;
        public int WordLength;
        public int Format;
        public int Scaling;
        public int ScalingOffset;
    }

    public struct BitData
    {
        public string Name;
        public string DataWordName;
        public int Length;
        public int StartbitNumber;
        public string EnumLink;
    }

    public struct EnumIndex
    {
        public string DataWordName;
        public string Name;
        public int Index;
    }


    public class Symbols
    {
        public SortedList<string, Message> NewSymbol = new SortedList<string, Message>();
        public SortedList<string, SubMessage> NewSubId = new SortedList<string, SubMessage>();
        public SortedList<string, DataWord> NewData = new SortedList<string, DataWord>();
        public SortedList<string, BitData> NewBit = new SortedList<string, BitData>();
        public SortedList<string, EnumIndex> NewEnum = new SortedList<string, EnumIndex>();
    }

    public enum ListTypes
    {
        SUBMESSAGE_TYPE,DATAMESSAGE_TYPE,BITMESSAGE_TYPE

    }

    public enum TriggerTypes
    {
        BEGIN, MIDDLE, END
    }

    public enum TriggerReference
    {
        IDENT, DATA, BIT
    }

    //public struct TriggerOptionsStruct
    //{
    //    public bool TriggerAtBegin;
    //    public bool TriggerInCenter;
    //    public bool TriggerAtEnd;
    //    public bool TriggerOnIdent;
    //    public bool TriggerOnWord;
    //    public bool TriggerOnBit;
    //    public int WordNumber;
    //    public int BitNumber;
    //    public int WordLength;
    //    public int BitValue;
    //    public int TriggerCount;

    //}





}
